/*
 * Wazuh databaseFeedManager
 * Copyright (C) 2015, Wazuh Inc.
 * January 12, 2024.
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General Public
 * License (version 2) as published by the FSF - Free Software
 * Foundation.
 */
#ifndef _MOCK_RESULTINDEXER_HPP
#define _MOCK_RESULTINDEXER_HPP

#include "MockIndexerConnector.hpp"
#include "scanContext.hpp"
#include "gmock/gmock.h"

constexpr int RESULT_INDEXER_ID {5};

/**
 * @class TMockResultIndexer
 *
 * @brief  The `TMockResultIndexer` class does not provide mock implementation of methods
 * but allows to use a simplified context data.
 *
 * This class is used in unit tests only.
 *
 */
template<typename TIndexerConnector = MockIndexerConnector>
class TMockResultIndexer : public AbstractHandler<std::shared_ptr<std::vector<int>>>
{
public:
    /**
     * @brief Construct a new TMockResultIndexer object
     *
     * @param indexerConnector TIndexerConnector instance.
     */
    TMockResultIndexer(std::shared_ptr<TIndexerConnector> indexerConnector) {};
    virtual ~TMockResultIndexer() = default;

    /**
     * @brief Handles request and passes control to the next step of the chain.
     *
     * @param data Mocked context data
     * @return std::shared_ptr<std::vector<int>>
     */
    std::shared_ptr<std::vector<int>> handleRequest(std::shared_ptr<std::vector<int>> data) override
    {
        data->push_back(RESULT_INDEXER_ID);
        return AbstractHandler<std::shared_ptr<std::vector<int>>>::handleRequest(std::move(data));
    }
};

using MockResultIndexer = TMockResultIndexer<>;

#endif // _MOCK_RESULTINDEXER_HPP
